package com.example.joke.select

import android.content.Intent
import android.os.Bundle
import com.example.joke.R
import com.example.joke.base.navigationbar.AbsNavigationBar
import com.example.joke.databinding.ActivityUploadImageBinding
import com.example.joke.frame.BaseSkinActivity
import com.example.joke.frame.DefaultNavigationBar

class UploadImageActivity : BaseSkinActivity<ActivityUploadImageBinding>() {

//    private lateinit var btn: Button
//    private lateinit var rv: RecyclerView
    private var mImageList: ArrayList<String> = ArrayList()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_upload_image)
    }

    override fun setListener() {
    }

    override fun initData() {
//        rv = findViewById(R.id.rv)
//        btn = findViewById(R.id.btn)
        binding.btn.setOnClickListener {
            // 搞一个中间层，链式调用
//            val intent = Intent(this, SelectImageActivity::class.java)
//            intent.putExtra(EXTRA_SELECT_COUNT, 9)
//            intent.putExtra(EXTRA_SELECT_MODE, MODE_MULTI)
//            intent.putStringArrayListExtra(EXTRA_DEFAULT_SELECT_LIST, mImageList)
//            intent.putExtra(EXTRA_SHOW_CAMERA, true)
//            startActivity(intent)
            ImageSelector.create().maxCount(9).mode(MODE_MULTI).showCamera(true).origin(mImageList).start(this, 0)
        }
    }

    override fun initTitle() {
        DefaultNavigationBar.Builder(this)
            .setTitle("上传图片")
            .builder<AbsNavigationBar.Builder.AbsNavigationParams>()    }

    override fun getBinding1(): ActivityUploadImageBinding {
        return ActivityUploadImageBinding.inflate(layoutInflater)
    }
}